package com.dreem.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: DesignParrtern
 * @description: 学院
 * @author: Peng
 * @create: 2021-02-21  09:11
 **/
public class College extends OrganizationComponent {

    List<OrganizationComponent> organizationComponents = new ArrayList<>();

    public College(String name, String des){
        this.setDes(des);
        this.setName(name);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponents.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponents.remove(organizationComponent);
    }

    @Override
    public String getDes() {
        return super.getDes();
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    protected void print() {
//        System.out.println(getName());
        for(OrganizationComponent organizationComponent : organizationComponents){
            System.out.print("系 ： ");
//            System.out.println(organizationComponent.getName());
            organizationComponent.print();
        }
    }
}
